﻿@model IEnumerable<Scrumrun.Models.UserStory>

@{
    ViewBag.Title = "Backlog";
}

<h3>@ViewBag.ProjectName</h3>

<div class="row mainwrapper">
    <div class="span2">
        <ul class="unstyled">
            <li>
                @*@Html.ActionLink("Project", "Details", "Project", new { id = ViewBag.CurrentProject }, new { @class="btn btn-warning"} )*@
                <a class="btn btn-warning" href="@Url.Action("Details", "Project", new { id = ViewBag.CurrentProject })">
                    <i class="icon-th-large icon-white"></i> Project
                </a>                
            </li>
            <li>&nbsp;</li>
            <li>
                @Html.ActionLink("View Board", "SprintBoard", "Sprint", new { ProjectId = ViewBag.CurrentProject }, new { @class="btn btn-primary"} )
            </li>
        </ul>
        <br />

        @Html.Action("SprintList", "Iteration", new {ProjectId = ViewBag.CurrentProject})

        <br />
        <ul class="unstyled">
            <li>
                @*@Html.ActionLink("Manage Sprint", "Index", "Iteration", new { ProjectId = ViewBag.CurrentProject }, new { @class="btn"} )*@
                <a class="btn" href="@Url.Action("EditSprints", "Project", new { ProjectId = ViewBag.CurrentProject })">
                    <i class="icon-wrench"></i> Manage Sprint
                </a>
            </li>
        </ul>

        <div class="alert alert-info"><button type="button" class="close" data-dismiss="alert">&times;</button>
            You can sort userstories by dragging them up or down in the list or drop it on the sprint list to assign to that sprint.</div>

    </div>
    <!--sidebar-->

    <div class="span10">
        <div class="contentwrap">
            <h4>Backlog</h4>

            <div class="inline">
            @using (Html.BeginForm("Create", "Backlog", FormMethod.Post))
            {
            <fieldset>
                <legend>Userstory</legend>

                <div class="input-append">
                    <input class="span9" id="Title" name="Title" type="text" value="" placeholder="Add new userstory"/>
                    <button class="btn" type="submit"><i class="icon-plus"></i>Add</button>
                </div>

                <span class="field-validation-valid" data-valmsg-for="Description" data-valmsg-replace="true"></span>

                <input id="BackLogPriority" name="BackLogPriority" type="hidden" value="1000" />
                <input id="Effort" name="Effort" type="hidden" value="1" />
                <input id="UserProfile_UserId" name="UserId" type="hidden" value="" />
                <input id="Project_ProjectId" name="Project_ProjectId" type="hidden" value="@ViewBag.CurrentProject" />
                <input id="ItemStatus_ItemStatusId" name="ItemStatus_ItemStatusId" type="hidden" value="1" />
                <input id="Sprint_SprintId" name="Sprint_SprintId" type="hidden" value="1" />
                <input id="CompletedDate" name="Sprint_SprintId" type="hidden" value="" />

            </fieldset>
             }

            </div>

            <table id="tsortable" class="srtable">
                <tr>
                    <th></th>
                    <th>
                        @Html.DisplayNameFor(model => model.Title)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.ItemStatus.Status)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Effort)
                    </th>
                    <th>Iteration
                                @*Html.DisplayNameFor(model => model.Sprint.Name)*@
                    </th>
                </tr>
                <tbody>
                    @foreach (var item in Model)
                    {
                        <tr data-id="@item.Id">
                            <td>
                                <i class="icon-move"></i>
                                <a class="editForm" href="@Url.Action("Edit", new { id = item.Id })">
                                    <i class="icon-pencil"></i>
                                </a>
                                @*@Html.ActionLink("Edit", "Edit", new { id = item.Id })*@
                            </td>
                            <td style="min-width:500px">
                                @Html.DisplayFor(modelItem => item.Title)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.ItemStatus.Status)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Effort)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.Sprint.Name)
                                @*@Html.DropDownList("SprintSprintId", item.Sprint.Name)*@
                            </td>
                        </tr>
                    }
                </tbody>
            </table>

            <!--tasks-->
        </div>
    </div>
</div>


@Html.Hidden("PrioritySortURL",Url.Action("PrioritySort","Backlog"));

@Html.Hidden("ProjectId", (string)ViewBag.CurrentProject)



@*<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Title)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.BackLogPriority)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Effort)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.UserId)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Project.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.ItemStatus.Status)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Sprint.Name)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.BackLogPriority)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Effort)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UserId)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Project.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ItemStatus.Status)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Sprint.Name)
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
            @Html.ActionLink("Details", "Details", new { id = item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.Id })
            </td>
        </tr>
    }

</table>*@
